package com.docker.fjk.controller;

import java.util.List;
import javax.servlet.http.HttpServletResponse;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.PutMapping;
import org.springframework.web.bind.annotation.DeleteMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import com.docker.common.annotation.Log;
import com.docker.common.core.controller.BaseController;
import com.docker.common.core.domain.AjaxResult;
import com.docker.common.enums.BusinessType;
import com.docker.fjk.domain.DockerClinic;
import com.docker.fjk.service.IDockerClinicService;
import com.docker.common.utils.poi.ExcelUtil;
import com.docker.common.core.page.TableDataInfo;

/**
 * 诊所信息维护Controller
 * 
 * @author ruoyi
 * @date 2025-04-09
 */
@RestController
@RequestMapping("/system/clinic")
public class DockerClinicController extends BaseController
{
    @Autowired
    private IDockerClinicService dockerClinicService;

    /**
     * 查询诊所信息维护列表
     */
    @PreAuthorize("@ss.hasPermi('system:clinic:list')")
    @GetMapping("/list")
    public TableDataInfo list(DockerClinic dockerClinic)
    {
        startPage();
        List<DockerClinic> list = dockerClinicService.selectDockerClinicList(dockerClinic);
        return getDataTable(list);
    }

    /**
     * 导出诊所信息维护列表
     */
    @PreAuthorize("@ss.hasPermi('system:clinic:export')")
    @Log(title = "诊所信息维护", businessType = BusinessType.EXPORT)
    @PostMapping("/export")
    public void export(HttpServletResponse response, DockerClinic dockerClinic)
    {
        List<DockerClinic> list = dockerClinicService.selectDockerClinicList(dockerClinic);
        ExcelUtil<DockerClinic> util = new ExcelUtil<DockerClinic>(DockerClinic.class);
        util.exportExcel(response, list, "诊所信息维护数据");
    }

    /**
     * 获取诊所信息维护详细信息
     */
    @PreAuthorize("@ss.hasPermi('system:clinic:query')")
    @GetMapping(value = "/{id}")
    public AjaxResult getInfo(@PathVariable("id") Long id)
    {
        return success(dockerClinicService.selectDockerClinicById(id));
    }

    /**
     * 新增诊所信息维护
     */
    @PreAuthorize("@ss.hasPermi('system:clinic:add')")
    @Log(title = "诊所信息维护", businessType = BusinessType.INSERT)
    @PostMapping
    public AjaxResult add(@RequestBody DockerClinic dockerClinic)
    {
        return toAjax(dockerClinicService.insertDockerClinic(dockerClinic));
    }

    /**
     * 修改诊所信息维护
     */
    @PreAuthorize("@ss.hasPermi('system:clinic:edit')")
    @Log(title = "诊所信息维护", businessType = BusinessType.UPDATE)
    @PutMapping
    public AjaxResult edit(@RequestBody DockerClinic dockerClinic)
    {
        return toAjax(dockerClinicService.updateDockerClinic(dockerClinic));
    }

    /**
     * 删除诊所信息维护
     */
    @PreAuthorize("@ss.hasPermi('system:clinic:remove')")
    @Log(title = "诊所信息维护", businessType = BusinessType.DELETE)
	@DeleteMapping("/{ids}")
    public AjaxResult remove(@PathVariable Long[] ids)
    {
        return toAjax(dockerClinicService.deleteDockerClinicByIds(ids));
    }
}
